package com.springcloud.consumer01.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

// 类似SSM中的<beans></beans>标签
@Configuration
public class RestTemplateConfig {
    // 类似<bean>标签
    @Bean
    // 负载均衡注解，RestTemplate在发送请求时就具备负载均衡的功能
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
